package com.olive.controller;

import java.util.HashMap;
import java.util.Map;

import com.olive.dto.HeadersWrapperDTO;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {
	
	@RequestMapping("/normalHeaders")
	public Map<String, Object> normalHeaders(@RequestHeader("user-id")Long userId,
											 @RequestHeader("tenant-id")Long tenantId,
											 @RequestHeader("user-name")String userName){
		Map<String, Object> map = new HashMap<>();
		map.put("userId", userId);
		map.put("tenantId", tenantId);
		map.put("userName", userName);
		return map;
	}

	@RequestMapping("/wrapperHeaders")
	public Map<String, Object> wrapperHeaders(HeadersWrapperDTO headers){
		Map<String, Object> map = new HashMap<>();
		map.put("userId", headers.getUserId());
		map.put("tenantId", headers.getTenantId());
		map.put("userName", headers.getUserName());
		return map;
	}

}
